﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WiTeach.ClassManagement.View;
using WiTeach.CourseManagement.DAL;
using WiTeach.JobManagement.View;

namespace WiTeach.CourseManagement.View
{

    /// <summary>
    /// CourseListContent.xaml 的交互逻辑
    /// </summary>
    public partial class ClassIndex : Page
    {
        public string classHourName;
        public int classHourID;
        public int lessonID;

        public ClassIndex()
        {
            InitializeComponent();
            // 修改页面背景主题
            ImageBrush brush = new ImageBrush();
            brush.Stretch = Stretch.Fill;
            brush.ImageSource = new BitmapImage(new Uri(App.backgroundImage, UriKind.RelativeOrAbsolute));
            this.Background = brush;

        }
        public ClassIndex(int ClassHour_ID, string ClassHour_Name, int LessonID)
        {
            InitializeComponent();
            // 修改页面背景主题
            ImageBrush brush = new ImageBrush();
            brush.Stretch = Stretch.Fill;
            brush.ImageSource = new BitmapImage(new Uri(App.backgroundImage, UriKind.RelativeOrAbsolute));
            this.Background = brush;
            this.classTitle.Content = ClassHour_Name;
            this.classHourName = ClassHour_Name;
            this.classHourID = ClassHour_ID;
            this.lessonID = LessonID;
        }

        #region 页面跳转事件实现
        private void StudyIndex(object sender, RoutedEventArgs e)
        {
            // 跳转到学一学
            ClassStudyIndex studyIndexPage = new ClassStudyIndex(classHourID, classHourName,lessonID);
            this.NavigationService.Navigate(studyIndexPage);
        }

        private void PractiseIndex(object sender, RoutedEventArgs e)
        {
            // 跳转到做一做
            ClassPractiseIndex practisePage = new ClassPractiseIndex(classHourName, lessonID,classHourID);
            this.NavigationService.Navigate(practisePage);

        }

        private void ExerciseIndex(object sender, RoutedEventArgs e)
        {
            // 跳转到练一练
            //ClassExerciseIndex exercisePage = new ClassExerciseIndex(classHourName);
            JobList jobList = new JobList(classHourName, lessonID, classHourID);
            this.NavigationService.Navigate(jobList);
            //NavigationService.GetNavigationService(this).Navigate(new Uri("/WiTeach;component/JobManagement/View/JobList.xaml", UriKind.Relative));

        }
        #endregion

        #region 页面导航事件实现
        private void backHome(object sender, RoutedEventArgs e)
        {
            CourseIndex courseIndex = new CourseIndex();
            this.NavigationService.Navigate(courseIndex);
        }

        private void backPreLevel(object sender, RoutedEventArgs e)
        {
            // 返回上一级
            this.NavigationService.GoBack();
        }
        #endregion


        private void classindex_backmain_mouse_enter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 66;
            image.Width = 104;
        }
        private void classindex_backmain_mouse_leave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 60;
            image.Width = 98;
        }
        private void classindex_back_mouse_enter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 66;
            image.Width = 104;
        }
        private void classindex_back_mouse_leave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 60;
            image.Width = 98;
        }

        private void classindex_choice_mouse_enter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 250;
            image.Width = 256;
        }
        private void classindex_choice_mouse_leave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 244;
            image.Width = 250;
        }
    }
}
